package butterknife;

import annotation.IdRes;
import ohos.agp.components.Component;
import butterknife.internal.ListenerClass;
import butterknife.internal.ListenerMethod;
import ohos.multimodalinput.event.TouchEvent;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static ohos.agp.components.Component.TouchEventListener;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Bind a method to an {@link TouchEventListener TouchEventListener} on the view for each ID specified.
 * <pre><code>
 * {@literal @}OnTouch(R.id.example) boolean onTouch() {
 *   Toast.makeText(this, "Touched!", Toast.LENGTH_SHORT).show();
 *   return false;
 * }
 * </code></pre>
 * Any number of parameters from
 * {@link TouchEventListener#onTouchEvent(Component, TouchEvent) onTouch} may be used
 * on the method.
 * <p>
 * If the return type of the method is {@code void}, true will be returned from the listener.
 *
 * @see TouchEventListener
 */
@Target(METHOD)
@Retention(RUNTIME)
@ListenerClass(
    targetType = "ohos.agp.components.Component",
    setter = "setTouchEventListener",
    type = "ohos.agp.components.Component.TouchEventListener",
    method = @ListenerMethod(
        name = "onTouchEvent",
        parameters = {
            "ohos.agp.components.Component",
            "ohos.multimodalinput.event.TouchEvent"
        },
        returnType = "boolean",
        defaultReturn = "true"
    )
)
public @interface OnTouch {
    static int NO_ID = -1;
  /** View IDs to which the method will be bound. */
  @IdRes int[] value() default { NO_ID };// View.NO_ID
}
